In this Tutorials section we cover and explain Method of Socket Classes in details for freshers and experienced
previous | Home | Next |
Methods Of the Socket Class
Socket is a logical end point of connection, from application programmer point of view socket is a process that is used by an application to send and received data over the network. A socket handle protocol spacific details on be half of application, To facilited communication using different protocol concurrently concept of port are introduced (a port is a number socket port no-02102 are reserved for standard protocol such as TCP/IP, HTTP,SMTP,FTP etc.)
Java.net .Socket class provide object represebtive of Tcp\Ip Socket , Socket object can be created either following two ways:
public Socket (String hostName, int port)throws Unknown Host Exception,IO Exception; public Socket(InetAddress hostName, int port)throws Unknown Host Exception,IO Exception;
So the Method is Socket Class
get Input Stream()
Returns in Input Stream to read data of the Socket.
public InputStream.getInputStream();
get Output Stream()
Returns an outputStream to write data to a Socket.
public OutputStream.getOutputStream();
Close(): close the connection;
public void close();
previous | Home | Next |